package com.audaque.springboot.foshanupload.web.datamongodbmodeldemo.model.pojo;

import lombok.*;
import org.mongodb.morphia.annotations.Entity;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;

/**
 * @author zgb
 * @desc ...
 * @date 2023-08-15 18:16:16
 */

@Entity
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@Document(collection = "book")
@Data
public class Book implements Serializable {

    /**
     * 使用@Id注解指定MongoDB中的 _id 主键
     */

    @Id
    private String id;

    private String name;

    //不要使用懒加载
   @DBRef(lazy = false)
    private Chapter chapter;
}
